<basics2:ChildWindow x:Class="Rage.UI.GemmingTemplates" Title="Edit Modification Templates"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:data="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:basics="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:basics2="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
  xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.WPFToolkit"
  xmlns:local="clr-namespace:Rage.UI"
  mc:Ignorable="d" Height="540" Width="650"
  WindowStyle="None" AllowsTransparency="True" ResizeMode="CanResizeWithGrip"
  x:Name="ThisWindow">

  <basics2:ChildWindow.Resources>
    <Style x:Key="NormalDialogTextStyle" TargetType="TextBlock">
      <Setter Property="TextWrapping" Value="Wrap" />
      <Setter Property="VerticalAlignment" Value="Top" />
      <Setter Property="Foreground" Value="#3DD1F2" />
      <Setter Property="Margin" Value="8,0" />
      <Setter Property="FontWeight" Value="Bold" />
    </Style>
    <Style x:Key="RectangleStyle" TargetType="Rectangle">
      <Setter Property="StrokeThickness" Value="2" />
      <Setter Property="RadiusX" Value="3" />
      <Setter Property="RadiusY" Value="3" />
      <Setter Property="Stroke" Value="#218AAD" />
      <Setter Property="Fill">
        <Setter.Value>
          <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
            <GradientStop Color="#218AAD" Offset="0" />
            <GradientStop Color="#020D18" Offset="0.35" />
            <GradientStop Color="#020D18" Offset="0.55" />
            <GradientStop Color="#218AAD" Offset="1" />
          </LinearGradientBrush>
        </Setter.Value>
      </Setter>
    </Style>
    <Style x:Key="ButtonStyle" TargetType="Button">
      <Setter Property="Background" Value="#020D18" />
      <Setter Property="Foreground" Value="#3DD1F2" />
      <Setter Property="BorderBrush" Value="#155981" />
      <Setter Property="HorizontalAlignment" Value="Left" />
      <Setter Property="Width" Value="46" />
      <Setter Property="FontWeight" Value="Bold" />
    </Style>
    <Style x:Key="NormalDialogCheckStyle" TargetType="CheckBox">
      <Setter Property="VerticalAlignment" Value="Top" />
      <Setter Property="Foreground" Value="#3DD1F2" />
      <Setter Property="Margin" Value="8,0" />
      <Setter Property="FontWeight" Value="Bold" />
      <Setter Property="IsThreeState" Value="True" />
    </Style>
  </basics2:ChildWindow.Resources>

  <Grid x:Name="LayoutRoot" Background="#FF0E3956">
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <Grid>
      <Popup x:Name="ArmoringPopup" Grid.Row="1"><local:ItemListControl x:Name="ComparisonArmoringList"/></Popup>
      <Popup x:Name="BarrelPopup" Grid.Row="1"><local:ItemListControl x:Name="ComparisonBarrelList"/></Popup>
      <Popup x:Name="HiltPopup" Grid.Row="1"><local:ItemListControl x:Name="ComparisonHiltList"/></Popup>
      <Popup x:Name="ModPopup" Grid.Row="1"><local:ItemListControl x:Name="ComparisonModList"/></Popup>
      <Popup x:Name="EnhancementPopup" Grid.Row="1"><local:ItemListControl x:Name="ComparisonEnhancementList"/></Popup>
      <Popup x:Name="ColorCrystalPopup" Grid.Row="1"><local:ItemListControl x:Name="ComparisonColorCrystalList"/></Popup>
      <Popup x:Name="AugmentPopup" Grid.Row="1"><local:ItemListControl x:Name="ComparisonAugmentList"/></Popup>
    </Grid>

    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border Margin="0" BorderBrush="#228FBB" BorderThickness="5" CornerRadius="10" Background="#FF0C1E2A" x:Name="DraggableBorder" MouseDown="DraggableBorder_MouseDown" MouseLeftButtonUp="DraggableBorder_MouseLeftButtonUp">
        <TextBlock Text="{Binding ElementName=ThisWindow, Path=Title}" Foreground="#F5C542" FontWeight="UltraBold" FontSize="16" VerticalAlignment="Center" Margin="40,4,4,4" />
      </Border>
      <Button Style="{StaticResource ButtonStyle}" BorderBrush="Transparent" VerticalAlignment="Top" Grid.Column="1" Content="[]]" Width="22" Height="22" Margin="4,4,1,4" Name="BT_Restore" Click="BT_Restore_Click" HorizontalAlignment="Center" />
      <Button Style="{StaticResource ButtonStyle}" BorderBrush="Transparent" VerticalAlignment="Top" Grid.Column="2" Content="_" Width="22" Height="22" Margin="0,4,1,4" Name="BT_Minimize" Click="BT_Minimize_Click" HorizontalAlignment="Center" />
      <Button Style="{StaticResource ButtonStyle}" BorderBrush="Transparent" VerticalAlignment="Top" Grid.Column="3" Content="[]" Width="22" Height="22" Margin="0,4,1,4" Name="BT_Maximize" Click="BT_Maximize_Click" HorizontalAlignment="Center" />
      <Button Style="{StaticResource ButtonStyle}" BorderBrush="Transparent" VerticalAlignment="Top" Grid.Column="4" Content="X" Width="22" Height="22" Margin="0,4,4,4" Name="BT_Close" Click="OKButton_Click" HorizontalAlignment="Center" />
    </Grid>
    <Border Margin="4,2" BorderBrush="#FF228FBB" Grid.Row="1" BorderThickness="1" CornerRadius="6" Background="#FF0C1E2A">
      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <TextBlock Style="{StaticResource NormalDialogTextStyle}" Grid.Row="0" Text="Check the Template Groups you primarily use or check individual Templates." />
        <TextBlock Style="{StaticResource NormalDialogTextStyle}" Grid.Row="1" Text="Click Add to add a new Custom Template and click the Boxes to fill them with the Gem Types." />
        <TextBlock Style="{StaticResource NormalDialogTextStyle}" Grid.Row="2" Text="Rage will build gemmings of each known item, based on enabled gemming templates." />
        <TextBlock Style="{StaticResource NormalDialogTextStyle}" Grid.Row="3" Text="The following gemming templates are defined for the current model:" />
        <Grid Grid.Row="4" Margin="8,0">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
          </Grid.ColumnDefinitions>
          <TextBlock Style="{StaticResource NormalDialogTextStyle}" VerticalAlignment="Center" Margin="0,0,2,0" Grid.Column="0"
                     Text="Top Gemmings to Show:" />
          <inputToolkit:NumericUpDown x:Name="GemmingsShownNum" Width="35" Margin="2,0,0,0" ValueChanged="GemmingsShownChanged" Grid.Column="1" Maximum="25" Foreground="#FF3DD1F2" FontWeight="Bold" />
          <TextBlock x:Name="LB_GemInfo" Style="{StaticResource NormalDialogTextStyle}" Grid.Row="7" Grid.Column="2"
                   Text="Rage will show the top {0} moddings for an item, plus any equipped or custom moddings, if not already included in the top {0}." VerticalAlignment="Center" />
        </Grid>
      </Grid>
    </Border>
    <Border Margin="4,2" BorderBrush="#FF228FBB" Grid.Row="2" BorderThickness="1" CornerRadius="6" Background="#FF0C1E2A">
      <ScrollViewer VerticalScrollBarVisibility="Auto">
        <StackPanel>
          <Grid Margin="2">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="50"/>
              <ColumnDefinition Width="25"/>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Rectangle Style="{StaticResource RectangleStyle}" Grid.ColumnSpan="9" />
            <Rectangle Fill="#020D18" Stroke="#218AAD" StrokeThickness="1" Width="3" Margin="0,3" HorizontalAlignment="Right" Grid.Column="1" />
            <Rectangle Fill="#020D18" Stroke="#218AAD" StrokeThickness="1" Width="3" Margin="0,3" HorizontalAlignment="Right" Grid.Column="2" />
            <Rectangle Fill="#020D18" Stroke="#218AAD" StrokeThickness="1" Width="3" Margin="0,3" HorizontalAlignment="Right" Grid.Column="3" />
            <Rectangle Fill="#020D18" Stroke="#218AAD" StrokeThickness="1" Width="3" Margin="0,3" HorizontalAlignment="Right" Grid.Column="4" />
            <Rectangle Fill="#020D18" Stroke="#218AAD" StrokeThickness="1" Width="3" Margin="0,3" HorizontalAlignment="Right" Grid.Column="5" />
            <Rectangle Fill="#020D18" Stroke="#218AAD" StrokeThickness="1" Width="3" Margin="0,3" HorizontalAlignment="Right" Grid.Column="6" />
            <Rectangle Fill="#020D18" Stroke="#218AAD" StrokeThickness="1" Width="3" Margin="0,3" HorizontalAlignment="Right" Grid.Column="7" />
            <TextBlock Style="{StaticResource NormalDialogTextStyle}" Margin="1,4" Grid.Column="0" HorizontalAlignment="Center" Text="Group" Grid.ColumnSpan="2" />
            <TextBlock Style="{StaticResource NormalDialogTextStyle}" Margin="1,4" Grid.Column="2" HorizontalAlignment="Center" Text="Armoring"/>
            <TextBlock Style="{StaticResource NormalDialogTextStyle}" Margin="1,4" Grid.Column="3" HorizontalAlignment="Center" Text="Barrel"/>
            <TextBlock Style="{StaticResource NormalDialogTextStyle}" Margin="1,4" Grid.Column="4" HorizontalAlignment="Center" Text="Hilt"/>
            <TextBlock Style="{StaticResource NormalDialogTextStyle}" Margin="1,4" Grid.Column="5" HorizontalAlignment="Center" Text="Mod"/>
            <TextBlock Style="{StaticResource NormalDialogTextStyle}" Margin="1,4" Grid.Column="6" HorizontalAlignment="Center" Text="Enhance"/>
            <TextBlock Style="{StaticResource NormalDialogTextStyle}" Margin="1,4" Grid.Column="7" HorizontalAlignment="Center" Text="ColorCrystal"/>
            <TextBlock Style="{StaticResource NormalDialogTextStyle}" Margin="1,4" Grid.Column="8" HorizontalAlignment="Center" Text="Augment"/>
          </Grid>
          <StackPanel x:Name="GroupStack" Orientation="Vertical">
            <!-- This is where new templates get added -->
          </StackPanel>
          <toolkit:Expander IsExpanded="true" Margin="2">
            <toolkit:Expander.Header>
              <CheckBox x:Name="CustomCheck" Content="Custom" Style="{StaticResource NormalDialogCheckStyle}"
                        Checked="groupCheckBox_Checked" Unchecked="groupCheckBox_Checked" Indeterminate="groupCheckBox_Checked"/>
            </toolkit:Expander.Header>
            <StackPanel>
              <StackPanel x:Name="CustomStack"/>
              <Button x:Name="BT_Add" Style="{StaticResource ButtonStyle}" Margin="2" Content="Add" Click="AddTemplate" />
            </StackPanel>
          </toolkit:Expander>
        </StackPanel>
      </ScrollViewer>
    </Border>
    <Button x:Name="BT_OK" Content="Done" Click="OKButton_Click" Width="75" HorizontalAlignment="Right" Grid.Row="3" Margin="4,2,4,4"
            Style="{StaticResource ButtonStyle}" />
  </Grid>
</basics2:ChildWindow>
